package com.example.paimengshop;

import com.example.paimengshop.client_socket.ReceiveFromServer;
import com.example.paimengshop.client_socket.SendToServer;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Pos;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.layout.AnchorPane;

import java.net.URL;
import java.util.Objects;
import java.util.ResourceBundle;

public class SignUpController implements Initializable
{
    @FXML
    AnchorPane signUpPane;

    @FXML
    PasswordField passwordInput;

    @FXML
    PasswordField passwordConfirm;

    @FXML
    Label mailLabel;

    @FXML
    Button submitBtn;

    public void OnSubmitBtnClicked()
    {
        if(!Objects.equals(passwordInput.getText(), passwordConfirm.getText()))        //两次输入的密码不同
        {
            Alert alert =new Alert(Alert.AlertType.INFORMATION);
            alert.setTitle("重置密码");
            alert.setContentText("两次输入的密码不一致");
            alert.setHeaderText("注意");
            alert.showAndWait();
        }
        else
        {
            //注册成功
        }
    }

    @Override
    public void initialize(URL url, ResourceBundle resourceBundle)
    {
        signUpPane.getStylesheets().add(getClass().getResource("All.css").toExternalForm());

        passwordInput.getStyleClass().add("input-group");
        passwordConfirm.getStyleClass().add("input-group");
        submitBtn.getStyleClass().add("btn-basic");

        mailLabel.setAlignment(Pos.TOP_LEFT);
        passwordInput.setPromptText("输入密码");
        passwordConfirm.setPromptText("确认密码");
    }
}
